def foo():
    i = 0
    while True:
        yield i
        i += 1

g = foo()
for j in range(10):
    print(next(g), end = ' ')